package homework;
import java.util.*;
public class news1{
    public static void main(String[] args) {
        ArrayList ay = new ArrayList<>();
        ay.add(new News("标题1jadjiadjaljsdiaswdadw"));
        ay.add(new News("标题2"));
        int size=ay.size();
        for(int i=size-1;i>=0;i--){
            News ns=(News)ay.get(i);
            System.out.println(processtitle(ns.getTitle()));
        }
    }
    public static String processtitle(String title){
         if(title==null){
            return "";
         }
         if(title.length()>15){
            return title.substring(0, 15)+"...";
         }else return title;
    }
}
class News{
    private String title;
    private String content;
    public News(String title){
        this.title=title;
    }
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    @Override
    public String toString() {
        // TODO Auto-generated method stub
        return "News{"+"title='"+title+'\''+'}';
    }
}